/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author phuong
 */
public class Jobseeker extends AbstractTableModel{
    private ArrayList<Entity.Jobseeker> Jobseekers;
    private final String columName[] = {"JobseekerID", "Name", "Sex", "PhoneNumber", };
    private final Class columClass[] = {Integer.class, String.class, String.class, String.class};

    public Jobseeker(ArrayList<Entity.Jobseeker> Jobseeker) {
        this.Jobseekers = Jobseeker;
    }

    public int getRowCount() {
        return Jobseekers.toArray().length;
    }

    public int getColumnCount() {
        return columName.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        switch (columnIndex) {
            case 0:
                return Jobseekers.get(rowIndex).getJobseekerID();

            case 1:
                return Jobseekers.get(rowIndex).getName();

            case 2:
                if(Jobseekers.get(rowIndex).isSex() == true)
                return "Male";
                else
                return "Female";

            case 3:
                return Jobseekers.get(rowIndex).getPhoneNumber();

            default:
                return null;
        }
    }
    @Override
    public String getColumnName(int Col) {
        return columName[Col];
    }

    @Override
    public Class getColumnClass(int Col) {
        return columClass[Col];
    }
}
